#include <iostream>
#include <unistd.h>
#include <signal.h>

void handler(int signo)
{
    std::cout <<"获得一个2号信号 ->"<< "handler:" << signo << std::endl;
    exit(1);
}


void Usage(const std::string& proc)
{
    std::cout << "\nUsage " << proc << "-signumber process\n" << std::endl;
}

int main(int argc, char* argv[])
{
    std::cout << "getpid:" << getpid() << std::endl;
    //输入非法则提示重新输入
    if(argc != 3)
    {
        Usage(argv[0]);
        exit(0);
    }

    //通过用户输入获取对应的信息
    int processid = std::stoi(argv[2]);
    int signumber = std::stoi(argv[1]+1);

    //系统调用接口
    kill(processid, signumber);









    //signal(2, handler);
    //while(true)
    //{
    //    sleep(1);
    //}
    return 0;
}
